package com.cos.consumer.fallback;

import com.cos.consumer.feign.SupplierFeignClient;
import feign.hystrix.FallbackFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author: COS
 * @time: 2022/4/28 16:47
 * @description:
 */
@Component
public class SupplierFeignFallbackFactory implements FallbackFactory<SupplierFeignClient> {
    //注入我们为SupplierFeignClient服务所编写的服务降级类
    @Autowired
    private SupplierFeignClientFallBack fallBack;

    @Override
    public SupplierFeignClient create(Throwable cause) {
        cause.printStackTrace();
        return fallBack;
    }
}
